-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: strcmp function #18483
base: main
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍
|
PR Code Suggestions ✨
|
需要单测,以及函数的定义不对,缺少一个select list参数,代码编译不过的。 |
return opBinaryStrStrToFixed[int8](ivecs, result, proc, length, strcmp, nil) | ||
} | ||
|
||
func strcmp(s1, s2 string) int8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use int8 instead of int32? the function signature said int32.
args: []types.T{types.T_varchar, types.T_varchar}, | ||
retType: func(parameters []types.Type) types.Type { | ||
return types.T_int32.ToType() | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int32 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix type mismatch.
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #15359
What this PR does / why we need it:
Compatible with MySQL functions
PR Type
Enhancement
Description
Strcmp
function to perform string comparisons, compatible with MySQL'sstrcmp
.STRCMP
function ID and added it to the function ID map.strcmp
in the list of supported built-in string functions with proper overload definitions.Changes walkthrough 📝
func_binary.go
Add Strcmp function for string comparison
pkg/sql/plan/function/func_binary.go
Strcmp
function to handle string comparison.strcmp
helper function usingstrings.Compare
.function_id.go
Register STRCMP function ID and mapping
pkg/sql/plan/function/function_id.go
STRCMP
constant for function identification.strcmp
to function ID register map.list_builtIn.go
Add strcmp to supported built-in functions
pkg/sql/plan/function/list_builtIn.go
strcmp
to supported string built-in functions.strcmp
with varchar arguments.